package com.lyz.dataStructure.LeetCode;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/5/6 20:07
 *@Description:
 **/

//两数之和
public class Test1 {
    public static void main(String[] args) {

        Scanner in  = new Scanner(System.in);
        String s = in.nextLine();
        String[] s1 = s.split(",");
        int[] arr = new int[s1.length];
        for(int i =0;i<arr.length;i++){
            arr[i] = Integer.parseInt(s1[i]);
        }
        int target = in.nextInt();
         twoSum(arr,target);
    }

    public static int[] twoSum(int[] nums, int target) {
        Map<Integer,Integer> map = new HashMap<>();
        for(int i = 0; i<nums.length;i++){

            if(map.containsKey(nums[i])){
                return new int[]{
                        map.get(nums[i]),i};
            }
            map.put(target-nums[i],i);
        }
        return null;
    }
}


